﻿using smforj.common.model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;

namespace MonitorEquipmentFrm
{
    public partial class SysconfigFrm : Telerik.WinControls.UI.ShapedForm
    {
        public SysconfigFrm()
        {
            InitializeComponent();
            init();
        }


        private void init()
        { 

           
        }

        private void SysconfigFrm_Load(object sender, EventArgs e)
        {
            load();
        }


        private void load()
        {
            this.txtUTimeSpan.Text = GlobalCache.UTimeSpan.ToString();
            this.txtRTimeSpan.Text = GlobalCache.RTimeSpan.ToString();
            this.txtTTimeSpan.Text = GlobalCache.TTimeSpan.ToString();
        
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            cfa.AppSettings.Settings["UTimeSpan"].Value = this.txtUTimeSpan.Text.Trim();
            cfa.AppSettings.Settings["RTimeSpan"].Value = this.txtRTimeSpan.Text.Trim();
            cfa.AppSettings.Settings["TTimeSpan"].Value = this.txtTTimeSpan.Text.Trim();
            cfa.Save();

            GlobalCache.UTimeSpan = Convert.ToInt32(this.txtUTimeSpan.Text);
            GlobalCache.RTimeSpan = Convert.ToInt32(this.txtRTimeSpan.Text);
            GlobalCache.TTimeSpan = Convert.ToInt32(this.txtTTimeSpan.Text);
        }
    }
}
